package com.cw.reduce.filter;

import java.util.HashSet;
import java.util.Vector;

public class GroupSelFilter implements IFilter {
	public GroupSelFilter() {
	}

	private String getCharCount(int value) {
		String result = null;
		HashSet set = new HashSet();
		int[] eachint = new int[3];
		eachint[0] = value / 100;
		eachint[1] = value / 10 % 10;
		eachint[2] = value % 10;
		for (int i = 0; i < 3; i++) {
			set.add(eachint[i]);
		}
//		result = ThreeConstant.type036[3 - set.size()];
		// switch (set.size()) {
		// case 1:
		// result = ThreeConstant.type036[2];
		// break;
		// case 2:
		// result = ThreeConstant.type036[1];
		// break;
		// case 3:
		// result = ThreeConstant.type036[0];
		// break;
		// }
		return result;
	}

	/**
	 * startFilter
	 * 
	 * @param condition
	 *            Vector
	 * @param target
	 *            Vector
	 * @return Vector
	 * @todo Implement this cp.gui.reduce.filter.IFilter method
	 */
	public Vector startFilter(Vector condition, Vector<Integer> target) {
		Vector result = new Vector();
		String condi = (String) condition.elementAt(0);

		for (int i = 0; i < target.size(); i++) {
			int value = target.elementAt(i);
			if (condi.equals(getCharCount(value))) {
				result.add(value);
			}
		}
		return result;
	}
}
